﻿using System;
using System.Collections;


namespace SortOf
{
    public class Queue
    {
        private ArrayList queue;

        public Queue()
        {
            queue = new ArrayList();
        }

        public void EnQueue(object item)
        {
            queue.Add(item);
        }

        //Remove an object from the queue, returns the removed object
        public virtual Object DeQueue()
        {
            Object item = queue[0];
            queue.RemoveAt(0);
            return item;
        }

        public object Peek()
        {
            return queue[0];
        }

        public void ClearQueue()
        {
            queue.Clear();
        }

        public int Count()
        {
            return queue.Count;
        }

        //Converst the queue to an array with makes all slots readable
        public Object[] ToArray()
        {
            return queue.ToArray();
        }
    }
}
